package com.example.myui.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.example.myui.R;
import com.tapadoo.alerter.Alerter;
import com.tapadoo.alerter.OnHideAlertListener;
import com.tapadoo.alerter.OnShowAlertListener;

import butterknife.ButterKnife;
import butterknife.OnClick;

public class AlerterActivity extends AppCompatActivity {

    private String TAG = AlerterActivity.class.getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_alerter);
        ButterKnife.bind(this);
    }

    @OnClick(R.id.btn1)
    public void showAlerter(View view) {
        Alerter haha = Alerter.create(this)
                .setTitle("haha")
                .setText("woshi alerter");
        if (null != haha && !haha.isShowing()) {
            haha.show();
        }
    }

    @OnClick(R.id.btn2)
    public void showAlerter2(View view) {
        Alerter.create(this)
                .setTitle("title")
                .setText("hehehe")
                .setOnShowListener(new OnShowAlertListener() {
                    @Override
                    public void onShow() {
                        Log.i(TAG, "onShow: ");
                    }
                })
                .setOnHideListener(new OnHideAlertListener() {
                    @Override
                    public void onHide() {
                        Log.i(TAG, "onHide: ");
                    }
                })
                .setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Log.i(TAG, "onClick: ");
                    }
                })
                .enableVibration(false)
                .show();
    }
}
